package com.dk.service.impl;


import com.dk.mapper.SkillMapper;
import com.dk.mapper.TalentMapper;
import com.dk.pojo.Skill;
import com.dk.pojo.Talent;
import com.dk.service.SkillService;
import com.dk.service.TalentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class TalentServiceImpl implements TalentService {
    @Autowired
    private TalentMapper talentMapper;

    @Override
    public PageInfo<Talent> show(Integer pageNumber, Integer pageSize) {
        PageHelper.startPage(pageNumber,pageSize);
        List<Talent> list = talentMapper.selectByExample(null);
        PageInfo<Talent> page = new PageInfo<>(list);
        return page;
    }

    @Override
    public boolean addInfo(Talent talent) {
        return talentMapper.insert(talent) > 0;
    }

    @Override
    public Talent toUpdatet(Integer id) {
        return talentMapper.selectByPrimaryKey(id);
    }

    @Override
    public boolean updateInfo(Talent talent) {
        return talentMapper.updateByPrimaryKey(talent) > 0;
    }

    @Override
    public boolean deleteInfo(Integer id) {
        return talentMapper.deleteByPrimaryKey(id) > 0;
    }


}
